package thread;

import java.util.concurrent.CountDownLatch;

/**
 * @author weim
 * @date 18-8-29
 */
public class MyCountDownLatch {

    public static void main(String[] args) {

        CountDownLatch countDownLatch = new CountDownLatch(10);

        for(int i=0; i<10; i++) {
            new Thread(() -> {
                System.out.println("now size :" + countDownLatch.getCount());
                countDownLatch.countDown();
            }).start();
        }

        try {
            countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("end");

    }

}
